<font size="2" face="Tahoma"><b>Trang chủ</b></font>
<hr size="1" color="#cadadd" />
<?php
include_once '../lib/ofc-library/open_flash_chart_object.php';
open_flash_chart_object( '100%', 350, '/admin/visitor_data.php', false, '/' );

$dir_cms = "../uploads/cms/";
$hinh_cms = array();
$q = $db->query("SELECT * FROM cms");
while ($r = $db->fetch($q)) {
    $hinh_cms[] = $dir_cms.$r['hinh'];
    $hinh_cms[] = $dir_cms."cms_".$r['hinh'];
    $hinh_cms[] = $dir_cms."dt_".$r['hinh'];
}

foreach(glob($dir_cms.'*.*') as $filename){
    if (!in_array($filename, $hinh_cms))
        unlink($filename);
}

$dir_cms_menu = "../uploads/cms_menu/";
$hinh_cms_menu = array();
$q = $db->query("SELECT * FROM cms_menu");
while ($r = $db->fetch($q)) {
    $hinh_cms_menu[] = $dir_cms_menu.$r['hinh'];
    $hinh_cms_menu[] = $dir_cms_menu."room_".$r['hinh'];
    $hinh_cms_menu[] = $dir_cms_menu."ser_".$r['hinh'];
}

foreach(glob($dir_cms_menu.'*.*') as $filename){
    if (!in_array($filename, $hinh_cms_menu))
        unlink($filename);
}

$dir_gal = "../uploads/gal/";
$hinh_gal = array();
$q = $db->query("SELECT * FROM gallery");
while ($r = $db->fetch($q)) {
    $hinh_gal[] = $dir_gal.$r['hinh'];
    $hinh_gal[] = $dir_gal."ads_".$r['hinh'];
    $hinh_gal[] = $dir_gal."slide_".$r['hinh'];
    $hinh_gal[] = $dir_gal."thumb_".$r['hinh'];
}

foreach(glob($dir_gal.'*.*') as $filename){
    if (!in_array($filename, $hinh_gal))
        unlink($filename);
}

$dir_product = "../uploads/product/";
$hinh_product = array();
$q = $db->query("SELECT * FROM product");
while ($r = $db->fetch($q)) {
    $hinh_product[] = $dir_product.$r['hinh'];
    $hinh_product[] = $dir_product."thumb_".$r['hinh'];
}

foreach(glob($dir_product.'*.*') as $filename){
    if (!in_array($filename, $hinh_product))
        unlink($filename);
}


?>
